﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Linq;
using Ahi.Base;
using Ahi.Controller;
using Ahi.Entity;
using Ahi.Config;

namespace Ahi.Raporlama
{
    public partial class RaporListesiForm : ListeBaseForm
    {
        private DevExpress.XtraGrid.Columns.GridColumn colIsim;
        private DevExpress.XtraGrid.Columns.GridColumn colAciklama;
        private DevExpress.XtraGrid.Columns.GridColumn colKaynakKod;
        private DevExpress.XtraBars.Bar bar4;
        private DevExpress.XtraBars.BarButtonItem buttonTasarla;
        private DevExpress.XtraGrid.Columns.GridColumn colOlusturulmaZamani;

        public RaporListesiForm()
        {
            InitializeComponent();
        }

        public override void Listele()
        {
            bsData.DataSource = MongoAdaptor.Instance.GetData<RaporEntity>();
        }

        public override void DetayAc(object seciliEleman)
        {
            RaporGoruntuleyiciForm frm = new RaporGoruntuleyiciForm();
            frm.Id = ((RaporEntity)seciliEleman).Id;
            frm.Show();
        }

        public override void Yeni()
        {
            RaporTasarimForm frm = new RaporTasarimForm();
            frm.Show();
        }

        private void buttonTasarla_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (GetCurrent<RaporEntity>() == null) return;

            RaporTasarimForm frm = new RaporTasarimForm();
            frm.Id = GetCurrent<RaporEntity>().Id;
            frm.Show();
        }

        private void InitializeComponent()
        {
            this.colIsim = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colAciklama = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colKaynakKod = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colOlusturulmaZamani = new DevExpress.XtraGrid.Columns.GridColumn();
            this.bar4 = new DevExpress.XtraBars.Bar();
            this.buttonTasarla = new DevExpress.XtraBars.BarButtonItem();
            ((System.ComponentModel.ISupportInitialize)(this.bsData)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridListe)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridViewListe)).BeginInit();
            this.SuspendLayout();
            // 
            // bsData
            // 
            this.bsData.DataSource = typeof(Ahi.Entity.RaporEntity);
            // 
            // barManager1
            // 
            this.barManager1.Bars.AddRange(new DevExpress.XtraBars.Bar[] {
            this.bar4});
            this.barManager1.Items.AddRange(new DevExpress.XtraBars.BarItem[] {
            this.buttonTasarla});
            this.barManager1.MaxItemId = 5;
            // 
            // bar2
            // 
            this.bar2.OptionsBar.MultiLine = true;
            this.bar2.OptionsBar.UseWholeRow = true;
            this.bar2.Visible = false;
            // 
            // bar3
            // 
            this.bar3.OptionsBar.AllowQuickCustomization = false;
            this.bar3.OptionsBar.DrawDragBorder = false;
            this.bar3.OptionsBar.UseWholeRow = true;
            // 
            // barDockControlTop
            // 
            this.barDockControlTop.Size = new System.Drawing.Size(633, 49);
            // 
            // barDockControlBottom
            // 
            this.barDockControlBottom.Location = new System.Drawing.Point(0, 540);
            this.barDockControlBottom.Size = new System.Drawing.Size(633, 22);
            // 
            // barDockControlLeft
            // 
            this.barDockControlLeft.Location = new System.Drawing.Point(0, 49);
            this.barDockControlLeft.Size = new System.Drawing.Size(0, 491);
            // 
            // barDockControlRight
            // 
            this.barDockControlRight.Location = new System.Drawing.Point(633, 49);
            this.barDockControlRight.Size = new System.Drawing.Size(0, 491);
            // 
            // gridListe
            // 
            this.gridListe.DataSource = this.bsData;
            this.gridListe.Location = new System.Drawing.Point(0, 49);
            this.gridListe.Size = new System.Drawing.Size(633, 491);
            // 
            // gridViewListe
            // 
            this.gridViewListe.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            this.colIsim,
            this.colAciklama,
            this.colKaynakKod,
            this.colOlusturulmaZamani});
            this.gridViewListe.OptionsBehavior.Editable = false;
            // 
            // colIsim
            // 
            this.colIsim.Caption = "Isim";
            this.colIsim.FieldName = "Isim";
            this.colIsim.Name = "colIsim";
            this.colIsim.Visible = true;
            this.colIsim.VisibleIndex = 0;
            // 
            // colAciklama
            // 
            this.colAciklama.Caption = "Aciklama";
            this.colAciklama.FieldName = "Aciklama";
            this.colAciklama.Name = "colAciklama";
            this.colAciklama.Visible = true;
            this.colAciklama.VisibleIndex = 1;
            // 
            // colKaynakKod
            // 
            this.colKaynakKod.Caption = "KaynakKod";
            this.colKaynakKod.FieldName = "KaynakKod";
            this.colKaynakKod.Name = "colKaynakKod";
            // 
            // colOlusturulmaZamani
            // 
            this.colOlusturulmaZamani.Caption = "OlusturulmaZamani";
            this.colOlusturulmaZamani.FieldName = "OlusturulmaZamani";
            this.colOlusturulmaZamani.Name = "colOlusturulmaZamani";
            this.colOlusturulmaZamani.Visible = true;
            this.colOlusturulmaZamani.VisibleIndex = 2;
            // 
            // bar4
            // 
            this.bar4.BarName = "Custom 5";
            this.bar4.DockCol = 1;
            this.bar4.DockRow = 1;
            this.bar4.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
            this.bar4.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {
            new DevExpress.XtraBars.LinkPersistInfo(this.buttonTasarla)});
            this.bar4.Offset = 161;
            this.bar4.Text = "Custom 5";
            // 
            // buttonTasarla
            // 
            this.buttonTasarla.Caption = "Raporu Tasarla";
            this.buttonTasarla.Id = 4;
            this.buttonTasarla.Name = "buttonTasarla";
            this.buttonTasarla.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.buttonTasarla_ItemClick);
            // 
            // RaporListesiForm
            // 
            this.AcilistaYukle = true;
            this.ClientSize = new System.Drawing.Size(633, 562);
            this.Name = "RaporListesiForm";
            this.Text = "Rapor Listesi";
            ((System.ComponentModel.ISupportInitialize)(this.bsData)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.barManager1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridListe)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridViewListe)).EndInit();
            this.ResumeLayout(false);

        }
    }
}